package qj.ac.support;

import java.util.LinkedList;

import qj.ui.DesktopUI4;
import qj.util.Clipboard;
import qj.util.Cols;

public class ToStringRevert {
	public static void main(String[] args) {
		String str = Clipboard.getText();
		
		LinkedList<String> lines = new LinkedList<String>();
		
		String[] split = str.split("\r?\n");
		for (int i = 0; i < split.length; i++) {
			String line = split[i];
			line = line.replaceFirst("^\\s*\"", "")
					.replaceFirst("\"( \\+)?$", "")
					.replaceAll("\\\\\"", "\"");
			lines.add(line);
		}
		
		String ret = Cols.join(lines, "\n");
		
		System.out.println(ret);
		System.out.println("============ Copied to clipboard ===========");
		Clipboard.copy(ret);
	}
}
